# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=rdesktop-brute
_pkgname=rdesktop
pkgver=1.5.0
pkgrel=3
depends=('libx11' 'openssl' 'libao' 'libsamplerate')
pkgdesc='It connects to windows terminal servers - Bruteforce patch included.'
url='http://www.rdesktop.org/'
license=('GPL-3.0-only')
arch=('x86_64' 'aarch64')
depends=('rdesktop')
groups=('blackarch' 'blackarch-cracker')
source=("http://downloads.sourceforge.net/$_pkgname/$_pkgname-$pkgver.tar.gz"
        'http://www.foofus.net/~jmk/tools/rdp-brute-force-r805.diff')
sha512sums=('b83ecd08f5ee7606e5f045cf7e746383a7b6a514855a77056bcb0705753bab064beba1462e779ca252a50802640cdc1a16e4cc222188d7708876266a3e77fca3'
            '1c77b61176f017d728f7046833d2e9e8ab0bf0b3a28a40a5b3c24a1d82a0e6d8286dae454a67ad49ceb2752745988ce1a7cbc0a7f35a3af8eef8e1ba3a0d9e2e')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -i "$srcdir/rdp-brute-force-r805.diff"
}

build() {
  cd "$_pkgname-$pkgver"

  if [[ "$CARCH" == "x86_64" ]];
  then
    ./configure --prefix=/usr
  else
    ./configure --build=arm --prefix=/usr
  fi

  make
}

package() {
  cd "$_pkgname-$pkgver"

  install -Dm 755 rdesktop "$pkgdir/usr/bin/$pkgname"
}

